#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 第1行注释可以让这个hello.py文件直接在Unix/Linux/Mac上运行，
# 第2行注释表示.py文件本身使用标准UTF-8编码；
class Animal(object):
    def run(self):
        print("animal is running...")


class Dog(Animal):
    def run(self):
        print("dog is running")


class Cat(Animal):
    def run(self):
        print("cat is running")


class Tortoise(Animal):
    def run(self):
        print("tortoise is running")


# 特殊的类
class Time(object):
    def run(self):
        print("time is running")


def run_twice(Animal):
    Animal.run()


dog = Dog()
dog.run()
cat = Cat()
cat.run()
a = list()  # a是list类型
b = Animal()  # b是Animal类型
c = Dog()  # c是Dog类型
print("判断一个变量是否是某个类型可以用isinstance()判断")
print(isinstance(a, list))
print(isinstance(b, Animal))
print(isinstance(b, Dog))
print(isinstance(c, Dog))
print(isinstance(c, Animal))
print("#############调用run()方法#############")
run_twice(dog)
run_twice(Cat())
run_twice(Tortoise())
run_twice(Animal())
print("#############不是继承关系也能调用#############")
run_twice(Time())
